function GAD_Etom_Plot_Proportion_PlaceCell_Bar_Graph(Placeness_MetaData)
%% Fix bugs
for n = 1:size(Placeness_MetaData,2)
    if Placeness_MetaData(n).PlaceCell_Proportion == 0
        Placeness_MetaData(n).PlaceCell_Proportion = 0.00000000001;
    end
end

%% Step 1: Collect all Data

% G2_F4_17
[G17_saline, G17_saline_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F4_17', 'saline', 'AM');
[G17_e2, G17_e2_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F4_17', 'etomidate 2mg/kg', 'AM');
[G17_e4, G17_e4_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F4_17', 'etomidate 4mg/kg', 'AM');
[G17_e6, G17_e6_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F4_17', 'etomidate 6mg/kg', 'AM');
[G17_e7, G17_e7_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F4_17', 'etomidate 7mg/kg', 'AM');
[G17_e8, G17_e8_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F4_17', 'etomidate 8mg/kg', 'AM');

% G2_F4_18
[G18_saline, G18_saline_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F4_18', 'saline', 'AM');
[G18_e2, G18_e2_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F4_18', 'etomidate 2mg/kg', 'AM');
[G18_e4, G18_e4_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F4_18', 'etomidate 4mg/kg', 'AM');
[G18_e6, G18_e6_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F4_18', 'etomidate 6mg/kg', 'AM');
[G18_e7, G18_e7_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F4_18', 'etomidate 7mg/kg', 'AM');
[G18_e8, G18_e8_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F4_18', 'etomidate 8mg/kg', 'AM');

% G2_F5(2)_21
[G21_saline, G21_saline_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_21', 'saline', 'AM');
[G21_e2, G21_e2_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_21', 'etomidate 2mg/kg', 'AM');
[G21_e4, G21_e4_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_21', 'etomidate 4mg/kg', 'AM');
[G21_e6, G21_e6_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_21', 'etomidate 6mg/kg', 'AM');
[G21_e7, G21_e7_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_21', 'etomidate 7mg/kg', 'AM');
[G21_e8, G21_e8_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_21', 'etomidate 8mg/kg', 'AM');

% G2_F5(2)_28 (doesn't have data for etomidate 8mg/kg because of total sedation)
[G28_saline, G28_saline_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_28', 'saline', 'AM');
[G28_e2, G28_e2_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_28', 'etomidate 2mg/kg', 'AM');
[G28_e4, G28_e4_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_28', 'etomidate 4mg/kg', 'AM');
[G28_e6, G28_e6_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_28', 'etomidate 6mg/kg', 'AM');
[G28_e7, G28_e7_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_28', 'etomidate 7mg/kg', 'AM');

% G2_F5(2)_31
[G31_saline, G31_saline_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_31', 'saline', 'AM');
[G31_e2, G31_e2_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_31', 'etomidate 2mg/kg', 'AM');
[G31_e4, G31_e4_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_31', 'etomidate 4mg/kg', 'AM');
[G31_e6, G31_e6_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_31', 'etomidate 6mg/kg', 'AM');
[G31_e7, G31_e7_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_31', 'etomidate 7mg/kg', 'AM');
[G31_e8, G31_e8_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_31', 'etomidate 8mg/kg', 'AM');

% G2_F5(2)_34
[G34_saline, G34_saline_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_34', 'saline', 'AM');
[G34_e2, G34_e2_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_34', 'etomidate 2mg/kg', 'AM');
[G34_e4, G34_e4_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_34', 'etomidate 4mg/kg', 'AM');
[G34_e6, G34_e6_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_34', 'etomidate 6mg/kg', 'AM');
[G34_e7, G34_e7_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_34', 'etomidate 7mg/kg', 'AM');
[G34_e8, G34_e8_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_34', 'etomidate 8mg/kg', 'AM');

% G2_F5(2)_45
[G45_saline, G45_saline_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_45', 'saline', 'AM');
[G45_e2, G45_e2_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_45', 'etomidate 2mg/kg', 'AM');
[G45_e4, G45_e4_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_45', 'etomidate 4mg/kg', 'AM');
[G45_e6, G45_e6_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_45', 'etomidate 6mg/kg', 'AM');
[G45_e7, G45_e7_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_45', 'etomidate 7mg/kg', 'AM');
[G45_e8, G45_e8_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_45', 'etomidate 8mg/kg', 'AM');

% G2_F5(2)_53
[G53_saline, G53_saline_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_53', 'saline', 'AM');
[G53_e2, G53_e2_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_53', 'etomidate 2mg/kg', 'AM');
[G53_e4, G53_e4_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_53', 'etomidate 4mg/kg', 'AM');
[G53_e6, G53_e6_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_53', 'etomidate 6mg/kg', 'AM');
[G53_e7, G53_e7_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_53', 'etomidate 7mg/kg', 'AM');
[G53_e8, G53_e8_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F5(2)_53', 'etomidate 8mg/kg', 'AM');

% G2_F6(2)_36
[G36_saline1, G36_saline_M1] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F6(2)_36', 'saline', 'AM');
[G36_saline2, G36_saline_M2] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F6(2)_36', 'saline', 'day1');
G36_saline = cat(1, G36_saline1, G36_saline2);
G36_saline_M = cat(1, G36_saline_M1, G36_saline_M2);
[G36_e4, G36_e4_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F6(2)_36', 'etomidate 4mg/kg', 'AM');
[G36_e7, G36_e7_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F6(2)_36', 'etomidate 7mg/kg', 'AM');

% G2_F6(2)_42
[G42_saline, G42_saline_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F6(2)_42', 'saline', 'AM');
[G42_e7, G42_e7_M] = AM_Proportion_PlaceCell_One_Animal_One_Dose(Placeness_MetaData, 'G2_F6(2)_42', 'etomidate 7mg/kg', 'AM');

%% Step2: Organize & Summarize data

% get mean for each genotype under each dose
WT_saline_M = mean(cat(1, G18_saline_M, G28_saline_M, G31_saline_M, G34_saline_M, G42_saline_M));
MUT_saline_M = mean(cat(1, G17_saline_M, G21_saline_M, G45_saline_M, G53_saline_M, G36_saline_M));
WT_e2_M = mean(cat(1, G18_e2_M, G28_e2_M, G31_e2_M, G34_e2_M));
MUT_e2_M = mean(cat(1, G17_e2_M, G21_e2_M, G45_e2_M, G53_e2_M));
WT_e4_M = mean(cat(1, G18_e4_M, G28_e4_M, G31_e4_M, G34_e4_M));
MUT_e4_M = mean(cat(1, G17_e4_M, G21_e4_M, G45_e4_M, G53_e4_M, G36_e4_M));
WT_e6_M = mean(cat(1, G18_e6_M, G28_e6_M, G31_e6_M, G34_e6_M));
MUT_e6_M = mean(cat(1, G17_e6_M, G21_e6_M, G45_e6_M, G53_e6_M));
WT_e7_M = mean(cat(1, G18_e7_M, G28_e7_M, G31_e7_M, G34_e7_M, G42_e7_M));
MUT_e7_M = mean(cat(1, G17_e7_M, G21_e7_M, G45_e7_M, G53_e7_M, G36_e7_M));
WT_e8_M = mean(cat(1, G18_e8_M, G31_e8_M, G34_e8_M));
MUT_e8_M = mean(cat(1, G17_e8_M, G21_e8_M, G45_e8_M, G53_e8_M));

% get standard error for each genotype under each dose (from the mean of each animal, not individual experiment)
WT_saline_SE = calculate_standard_error(cat(1, G18_saline_M, G28_saline_M, G31_saline_M, G34_saline_M, G42_saline_M));
MUT_saline_SE = calculate_standard_error(cat(1, G17_saline_M, G21_saline_M, G45_saline_M, G53_saline_M, G36_saline_M));
WT_e2_SE = calculate_standard_error(cat(1, G18_e2_M, G28_e2_M, G31_e2_M, G34_e2_M));
MUT_e2_SE = calculate_standard_error(cat(1, G17_e2_M, G21_e2_M, G45_e2_M, G53_e2_M));
WT_e4_SE = calculate_standard_error(cat(1, G18_e4_M, G28_e4_M, G31_e4_M, G34_e4_M));
MUT_e4_SE = calculate_standard_error(cat(1, G17_e4_M, G21_e4_M, G45_e4_M, G53_e4_M, G36_e4_M));
WT_e6_SE = calculate_standard_error(cat(1, G18_e6_M, G28_e6_M, G31_e6_M, G34_e6_M));
MUT_e6_SE = calculate_standard_error(cat(1, G17_e6_M, G21_e6_M, G45_e6_M, G53_e6_M));
WT_e7_SE = calculate_standard_error(cat(1, G18_e7_M, G28_e7_M, G31_e7_M, G34_e7_M, G42_e7_M));
MUT_e7_SE = calculate_standard_error(cat(1, G17_e7_M, G21_e7_M, G45_e7_M, G53_e7_M, G36_e7_M));
WT_e8_SE = calculate_standard_error(cat(1, G18_e8_M, G31_e8_M, G34_e8_M));
MUT_e8_SE = calculate_standard_error(cat(1, G17_e8_M, G21_e8_M, G45_e8_M, G53_e8_M));

%% Step 3: Plot Data

figure
% plot for WT
subplot(1,2,1)
A = categorical({'0 (saline)'});
B = categorical({'2'});
C = categorical({'4'});
D = categorical({'6'});
E = categorical({'7'});
F = categorical({'8'});
X = cat(2,A,B,C,D,E,F);
X = reordercats(X,{'0 (saline)','2','4','6','7','8'});
Y = cat(2, WT_saline_M, WT_e2_M, WT_e4_M, WT_e6_M, WT_e7_M, WT_e8_M);
h=bar(X(1,1),Y(1,1),0.4,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.7);
h.CData(1,:) = [0 0 1]; % color up each individual bar
ylabel('Proportion of Place Cells');
xlabel('Etomidate Dose (mg/kg)');
hold on
h=bar(X(1,2),Y(1,2),0.4,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.6);
h.CData(1,:) = [0 0 1]; % color up each individual bar
hold on
h=bar(X(1,3),Y(1,3),0.4,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.5);
h.CData(1,:) = [0 0 1]; % color up each individual bar
hold on
h=bar(X(1,4),Y(1,4),0.4,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.4);
h.CData(1,:) = [0 0 1]; % color up each individual bar
hold on
h=bar(X(1,5),Y(1,5),0.4,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.3);
h.CData(1,:) = [0 0 1]; % color up each individual bar
hold on
h=bar(X(1,6),Y(1,6),0.4,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.2);
h.CData(1,:) = [0 0 1]; % color up each individual bar
hold on
err(1,1)=WT_saline_SE;
err(1,2)=WT_e2_SE;
err(1,3)=WT_e4_SE;
err(1,4)=WT_e6_SE;
err(1,5)=WT_e7_SE;
err(1,6)=WT_e8_SE;
er = errorbar(X,Y,[],err,'LineWidth',2);    
er.Color = [0 0 0];                            
er.LineStyle = 'None'; 
ylim([0,0.7]);
set(gca,'FontSize',20);
hold on

% scatter plots with horizontal offsets - quick & dirty
half_num_animals_in_plot = 2.5;
initial_offset = -0.3;
offset = initial_offset;

sh = scatter(repmat(A,size(G18_saline,1),1),G18_saline(:,1),80,'^','k','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(A,size(G28_saline,1),1),G28_saline(:,1),80,'^','b','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(A,size(G31_saline,1),1),G31_saline(:,1),80,'^','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(A,size(G34_saline,1),1),G34_saline(:,1),80,'^','c','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(A,size(G42_saline,1),1),G42_saline(:,1),80,'^','g','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2;
initial_offset = -0.3;
offset = initial_offset;

sh = scatter(repmat(B,size(G18_e2,1),1),G18_e2(:,1),80,'^','k','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(B,size(G28_e2,1),1),G28_e2(:,1),80,'^','b','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(B,size(G31_e2,1),1),G31_e2(:,1),80,'^','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(B,size(G34_e2,1),1),G34_e2(:,1),80,'^','c','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2;
initial_offset = -0.3;
offset = initial_offset;

sh = scatter(repmat(C,size(G18_e4,1),1),G18_e4(:,1),80,'^','k','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(C,size(G28_e4,1),1),G28_e4(:,1),80,'^','b','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(C,size(G31_e4,1),1),G31_e4(:,1),80,'^','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(C,size(G34_e4,1),1),G34_e4(:,1),80,'^','c','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2;
initial_offset = -0.3;
offset = initial_offset;

sh = scatter(repmat(D,size(G18_e6,1),1),G18_e6(:,1),80,'^','k','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(D,size(G28_e6,1),1),G28_e6(:,1),80,'^','b','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(D,size(G31_e6,1),1),G31_e6(:,1),80,'^','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(D,size(G34_e6,1),1),G34_e6(:,1),80,'^','c','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2.5;
initial_offset = -0.3;
offset = initial_offset;

sh = scatter(repmat(E,size(G18_e7,1),1),G18_e7(:,1),80,'^','k','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(E,size(G28_e7,1),1),G28_e7(:,1),80,'^','b','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(E,size(G31_e7,1),1),G31_e7(:,1),80,'^','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(E,size(G34_e7,1),1),G34_e7(:,1),80,'^','c','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(E,size(G42_e7,1),1),G42_e7(:,1),80,'^','g','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 1.5;
initial_offset = -0.3;
offset = initial_offset;

sh = scatter(repmat(F,size(G18_e8,1),1),G18_e8(:,1),80,'^','k','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(F,size(G31_e8,1),1),G31_e8(:,1),80,'^','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(F,size(G34_e8,1),1),G34_e8(:,1),80,'^','c','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

title('p-WT','FontSize',30);
hold off


% plot for MUT animals
subplot(1,2,2)
A = categorical({'0 (saline)'});
B = categorical({'2'});
C = categorical({'4'});
D = categorical({'6'});
E = categorical({'7'});
F = categorical({'8'});
X = cat(2,A,B,C,D,E,F);
X = reordercats(X,{'0 (saline)','2','4','6','7','8'});
Y = cat(2, MUT_saline_M, MUT_e2_M, MUT_e4_M, MUT_e6_M, MUT_e7_M, MUT_e8_M);
h=bar(X(1,1),Y(1,1),0.4,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.7);
h.CData(1,:) = [1 0 0]; % color up each individual bar
ylabel('Proportion of Place Cells');
xlabel('Etomidate Dose (mg/kg)');
hold on
h=bar(X(1,2),Y(1,2),0.4,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.6);
h.CData(1,:) = [1 0 0]; % color up each individual bar
hold on
h=bar(X(1,3),Y(1,3),0.4,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.5);
h.CData(1,:) = [1 0 0]; % color up each individual bar
hold on
h=bar(X(1,4),Y(1,4),0.4,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.4);
h.CData(1,:) = [1 0 0]; % color up each individual bar
hold on
h=bar(X(1,5),Y(1,5),0.4,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.3);
h.CData(1,:) = [1 0 0]; % color up each individual bar
hold on
h=bar(X(1,6),Y(1,6),0.4,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.2);
h.CData(1,:) = [1 0 0]; % color up each individual bar
hold on
err(1,1)=MUT_saline_SE;
err(1,2)=MUT_e2_SE;
err(1,3)=MUT_e4_SE;
err(1,4)=MUT_e6_SE;
err(1,5)=MUT_e7_SE;
err(1,6)=MUT_e8_SE;
er = errorbar(X,Y,[],err,'LineWidth',2);    
er.Color = [0 0 0];                            
er.LineStyle = 'None'; 
ylim([0,0.7]);
set(gca,'FontSize',20);
hold on

% scatter plots with horizontal offsets - quick & dirty
half_num_animals_in_plot = 2.5;
initial_offset = -0.3;
offset = initial_offset;

sh = scatter(repmat(A,size(G17_saline,1),1),G17_saline(:,1),80,'o','k','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(A,size(G21_saline,1),1),G21_saline(:,1),80,'o','b','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(A,size(G45_saline,1),1),G45_saline(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(A,size(G53_saline,1),1),G53_saline(:,1),80,'o','c','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(A,size(G36_saline,1),1),G36_saline(:,1),80,'o','g','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2;
initial_offset = -0.3;
offset = initial_offset;

sh = scatter(repmat(B,size(G17_e2,1),1),G17_e2(:,1),80,'o','k','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(B,size(G21_e2,1),1),G21_e2(:,1),80,'o','b','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(B,size(G45_e2,1),1),G45_e2(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(B,size(G53_e2,1),1),G53_e2(:,1),80,'o','c','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2.5;
initial_offset = -0.3;
offset = initial_offset;

sh = scatter(repmat(C,size(G17_e4,1),1),G17_e4(:,1),80,'o','k','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(C,size(G21_e4,1),1),G21_e4(:,1),80,'o','b','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(C,size(G45_e4,1),1),G45_e4(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(C,size(G53_e4,1),1),G53_e4(:,1),80,'o','c','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(C,size(G36_e4,1),1),G36_e4(:,1),80,'o','g','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2;
initial_offset = -0.3;
offset = initial_offset;

sh = scatter(repmat(D,size(G17_e6,1),1),G17_e6(:,1),80,'o','k','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(D,size(G21_e6,1),1),G21_e6(:,1),80,'o','b','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(D,size(G45_e6,1),1),G45_e6(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(D,size(G53_e6,1),1),G53_e6(:,1),80,'o','c','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2.5;
initial_offset = -0.3;
offset = initial_offset;

sh = scatter(repmat(E,size(G17_e7,1),1),G17_e7(:,1),80,'o','k','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(E,size(G21_e7,1),1),G21_e7(:,1),80,'o','b','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(E,size(G45_e7,1),1),G45_e7(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(E,size(G53_e7,1),1),G53_e7(:,1),80,'o','c','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(E,size(G36_e7,1),1),G36_e7(:,1),80,'o','g','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2;
initial_offset = -0.3;
offset = initial_offset;

sh = scatter(repmat(F,size(G17_e8,1),1),G17_e8(:,1),80,'o','k','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(F,size(G21_e8,1),1),G21_e8(:,1),80,'o','b','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(F,size(G45_e8,1),1),G45_e8(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(F,size(G53_e8,1),1),G53_e8(:,1),80,'o','c','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

title('\alpha5-i-KO','FontSize',30);
hold off

end